<template>
  <a-layout-sider width="200" style="background: #fff">
    <a-menu
        v-model:selectedKeys="selectKeys"
        mode="inline"
        :style="{ height: '100%', borderRight: 0 }"
    >

        <a-menu-item key="/welcome">
          <router-link to="/welcome">
            <coffee-outlinked/> &nbsp; 欢迎
          </router-link>
        </a-menu-item>
        <a-menu-item key="/passenger">
          <router-link to="/passenger">
            <coffee-outlinked/> &nbsp; 乘车人管理
          </router-link>
        </a-menu-item>
      <a-menu-item key="/ticket">
          <router-link to="/ticket">
            <coffee-outlinked/> &nbsp; 余票查询
          </router-link>
        </a-menu-item>
      <a-menu-item key="/my-ticket">
        <router-link to="/my-ticket">
          <coffee-outlinked/> &nbsp; 我的车票
        </router-link>
      </a-menu-item>
    </a-menu>
  </a-layout-sider>
</template>
<script>
import {defineComponent, ref, watch} from 'vue';
import router from "@/router";
export default defineComponent({
  name: "the-sider-view",

  setup() {
    const selectKeys = ref([]);

    watch(() => router.currentRoute.value.path, (newValue) => {
      console.log('watch',newValue);
      selectKeys.value=[];
      selectKeys.value.push(newValue);
    },{immediate: true});

    return{
      selectKeys
    }
  },
});
</script>
<style>
#components-layout-demo-top-side-2 .logo {
  float: left;
  width: 120px;
  height: 31px;
  margin: 16px 24px 16px 0;
  background: rgba(255, 255, 255, 0.3);
}

.ant-row-rtl #components-layout-demo-top-side-2 .logo {
  float: right;
  margin: 16px 0 16px 24px;
}

.site-layout-background {
  background: #fff;
}
</style>